package  com.NeuglsWorkStudio.UI.Buttons
{
	import flash.events.MouseEvent;
	public class TEffectedButton extends TSimpleButton
	{
		private var _FMouseOverBackColor:uint=0x0c0c0c;
		private var _FMouseOverBackColorAlpha:Number=new Number(0.1);
		
		public function TEffectedButton(ACaption:String="",IsHtml:Boolean=true,BaceColor:int=0x222222)
		{
			super(ACaption,IsHtml,BaceColor);
			this.addEventListener(MouseEvent.MOUSE_OVER,FMouseOver,false,0,true);
			this.addEventListener(MouseEvent.MOUSE_OUT,FMouseOut,false,0,true);
		}
		
		public function get MouseOverBackColorAlpha():Number
		{
			return _FMouseOverBackColorAlpha;
		}

		public function set MouseOverBackColorAlpha(value:Number):void
		{
			_FMouseOverBackColorAlpha = value;
		}

		public function get MouseOverBackColor():uint
		{
			return _FMouseOverBackColor;
		}

		public function set MouseOverBackColor(value:uint):void
		{
			_FMouseOverBackColor = value;
		}

		protected function FMouseOver(Event:MouseEvent):void{
			this.graphics.beginFill(_FMouseOverBackColor,_FMouseOverBackColorAlpha);
			this.graphics.drawRoundRect(0,0,this.width,this.height,5,5);
			this.graphics.endFill();
		}
		
		protected function FMouseOut(Event:MouseEvent):void{
			this.graphics.clear();
		}
		
		override protected function EnableChanged(V:Boolean):void{
			super.EnableChanged(V);
			if(V){
				this.addEventListener(MouseEvent.MOUSE_OVER,FMouseOver,false,0,true);
				this.addEventListener(MouseEvent.MOUSE_OUT,FMouseOut,false,0,true);
			}else{
				this.removeEventListener(MouseEvent.MOUSE_OVER,FMouseOver)
				this.addEventListener(MouseEvent.MOUSE_OUT,FMouseOut);
			}
			
		}
	}
}